package servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.MemberAdm;

@SuppressWarnings("serial")
public class ModMemFinServlet extends HttpServlet{
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.setCharacterEncoding("BIG5");
		String userID = req.getParameter("userID");
		String password = req.getParameter("password");
		String name = req.getParameter("name");
		String phone = req.getParameter("phone");
		String address = req.getParameter("address");
		String email = req.getParameter("email");
		boolean coMem = Boolean.parseBoolean(req.getParameter("coMem"));
		
		HttpSession session = req.getSession();
		long id = (Long)session.getAttribute("id");
		
		MemberAdm ma = new MemberAdm();
		ma.modifyMem(id, userID, password, name, phone, address, email, coMem);
		
		session.setAttribute("userID", userID);
		session.setAttribute("name", name);
		session.setAttribute("phone", phone);
		session.setAttribute("address", address);
		session.setAttribute("mail", email);
		session.setAttribute("coMem", coMem);
		
		req.getRequestDispatcher("./member/mydata.jsp").forward(req, resp);
	}
}
